home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** File: WindowPalette.c
- ** Written by: Eric Soldan
- **
- ** Copyright © 1990-1993 Apple Computer, Inc.
- ** All rights reserved.
- */
-
- /* You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes. */
-
-
-
- /*****************************************************************************/
-
-
-
- #include "App.h" /* Get the application includes/typedefs, etc. */
- #include "App.protos.h" /* Get the prototypes for application. */
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __UTILITIES__
- #include "Utilities.h"
- #endif
-
-
-
- /*****************************************************************************/
-
-
-
- extern short gPrintPage; /* Non-zero means we are printing. */
- /* DTS.Lib..framework global. */
-
- extern RgnHandle gCursorRgn; /* We handle cursors here, so we need */
- extern CursPtr gCursorPtr; /* to know about these things. */
- /* Above are DTS.Lib..framework globals. */
-
-
-
- /*****************************************************************************/
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See CalcFrameRgn() for info. */
-
- #pragma segment TheDoc
- void PaletteCalcFrameRgn(FileRecHndl frHndl, WindowPtr window, RgnHandle rgn)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl, window, rgn)
- #endif
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See ContentClick() for info. */
-
- #pragma segment TheDoc
- void PaletteContentClick(WindowPtr window, EventRecord *event, Boolean firstClick)
- {
- #ifndef __MWERKS__
- #pragma unused (firstClick)
- #endif
-
- ControlHandle ctl;
- short action, cnum;
-
- cnum = IsCtlEvent(window, event, &ctl, &action);
- return;
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See ContentKey() for info. */
-
- #pragma segment TheDoc
- Boolean PaletteContentKey(WindowPtr window, EventRecord *event, Boolean *passThrough)
- {
- #ifndef __MWERKS__
- #pragma unused (passThrough)
- #endif
-
- short cnum;
-
- cnum = IsCtlEvent(window, event, nil, nil);
- if (!cnum) {
- *passThrough = true;
- return(false);
- }
-
- return(true);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See DrawFrame() for info. */
-
- #pragma segment TheDoc
- void PaletteDrawFrame(FileRecHndl frHndl, WindowPtr window, Boolean activate)
- {
- MoveTo(0, (*frHndl)->fileState.topSidebar - 1);
- LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, (*frHndl)->fileState.topSidebar - 1);
- LineTo((*frHndl)->fileState.leftSidebar - 1 - 16384, 16383);
-
- BeginFrame(window);
- DoDrawControls(window, activate);
- EndFrame(window);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See FreeDocument() for info. */
-
- #pragma segment TheDoc
- OSErr PaletteFreeDocument(FileRecHndl frHndl)
- {
- return(DefaultFreeDocument(frHndl));
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See FreeWindow() for info. */
-
- #pragma segment TheDoc
- OSErr PaletteFreeWindow(FileRecHndl frHndl, WindowPtr window)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl, window)
- #endif
-
- return(noErr);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See ImageDocument() for info. */
-
- #pragma segment TheDoc
- OSErr PaletteImageDocument(FileRecHndl frHndl)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl)
- #endif
-
- WindowPtr curPort;
-
- GetPort(&curPort);
- if (!gPrintPage) { /* If not printing... */
- DoDrawControls(curPort, false); /* Draw the content controls. */
- }
-
- return(noErr);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See InitContent() for info. */
-
- #pragma segment TheDoc
- OSErr PaletteInitContent(FileRecHndl frHndl, WindowPtr window)
- {
- OSErr err;
-
- err = AddControlSet(window, (*frHndl)->fileState.sfType, kwStandardVis, 0, 0, nil);
- return(err);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See ResizeContent() for info. */
-
- #pragma segment TheDoc
- void PaletteResizeContent(WindowPtr window, short oldh, short oldv)
- {
- #ifndef __MWERKS__
- #pragma unused (window, oldh, oldv)
- #endif
-
- /* See DTS.StyleChat for a sample usage of this function. */
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See ScrollFrame() for info. */
-
- #pragma segment TheDoc
- void PaletteScrollFrame(FileRecHndl frHndl, WindowPtr window, long dh, long dv)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl, window, dh, dv)
- #endif
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See UndoFixup() for info. */
-
- #pragma segment TheDoc
- void PaletteUndoFixup(FileRecHndl frHndl, Point contOrg, Boolean afterUndo)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl, contOrg, afterUndo)
- #endif
-
- /* See DTS.Draw for an example of what you might do here. */
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See WindowCursor() for info. */
-
- #pragma segment TheDoc
- Boolean PaletteWindowCursor(FileRecHndl frHndl, WindowPtr window, Point globalPt)
- {
- #ifndef __MWERKS__
- #pragma unused (frHndl, window, globalPt)
- #endif
-
- /* For examples of applications that have non-arrow cursor regions,
- ** see DTS.StyleChat and DTS.Draw. */
-
- DoSetCursor(&qd.arrow);
- return(true);
- }
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does for appropriate document type(s). •• */
- /* See WindowGoneFixup() for info. */
-
- #pragma segment TheDoc
- void PaletteWindowGoneFixup(WindowPtr window)
- {
- #ifndef __MWERKS__
- #pragma unused (window)
- #endif
- }
-
-
-